package com.hd.appcommon.constant;

/**
 * <p>
 * 权限常量
 * </p>
 *
 * @author Administrator
 * @since 2019-01-16
 */
public interface PrivilegeConstant {
    //暂时三级菜单
    int MENU_LEVEL_1 = 1;

    int MENU_LEVEL_2 = 2;

    int MENU_LEVEL_3 = 3;

    int BUTTON_TOP = 4;

    int BUTTON_TABLE = 5;

    String CONN_CHAR = "-";

    String ROOT_PRIVILEGE_ID = "0000";

    String DEFAULT_PRIVILEGE_ID = "0001";

    static String createRealId(String realId) {
        String currentId;
        if (realId.contains(CONN_CHAR)) {
            int length = realId.length() - 5;
            currentId = realId.substring(0, length) + CONN_CHAR + String.format("%04d", Integer.parseInt(realId.substring(length + 1)) + 1);
        } else {
            currentId = String.format("%04d", Integer.parseInt(realId) + 1);
        }
        return currentId;
    }
}
